<template>
  <div>
    <el-table :data="list" border style="width: 100%">
      <el-table-column prop="id" label="活动名称" width="180"></el-table-column>
      <el-table-column prop="status" label="状态">
        <template ref="slot" slot-scope="scope">
          <el-button type="primary" v-if="scope.row.status === 1">启用</el-button>
          <el-button type="primary" v-if="scope.row.status === 2">禁用</el-button>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="primary" @click="willEdit(scope.row.id)">编辑</el-button>
          <del-btn @confirm="del(scope.row.id)"></del-btn>
        </template>
      </el-table-column>
    </el-table>
    <!-- {{count}} -->
  </div>
</template>

<script>
import { mapGetters, mapActions } from "vuex";
import { reqseckilldelete } from "../../../request/api";
import { successAlert } from "../../../utils/alert";
export default {
  mounted() {
    this.reqList();
  },
  computed: {
    ...mapGetters({
      list: "seckill/list",
      catelist: "shopCate/list",
    }),
  },
  methods: {
    ...mapActions({
      reqList: "seckill/reqList",
    }),
    //   点击修改
    willEdit(id) {
      this.$emit("willEdit", id);
          // console.log(this.user);
    },

    // 点击删除
    del(id) {
      reqseckilldelete({
        id: id,
      }).then((res) => {
        if (res.data.code === 200) {
          successAlert(res.data.msg);
          this.reqList();
        }
      });
    },
  },
  data() {
    return {
      // list: [],
    };
  },
  props:['user']
};
</script>

<style>
</style>